<template lang="html">
  <div class="pack_list">
    <div class="pack_tips">
      <div>推荐好友选购任意一款尊享礼包</div>
      <div>您将获得相应返利</div>
    </div>
    <div class="package_list">
        <!-- <navigator url="../../../pages/giftbagDetails/giftbagDetails?pid={{item.product_id}}&item_id={{item.item_id}}" hover-class="none"> -->
        <PrdItem v-for="(item, key) in list" :item="item" v-bind:key="key" pagetype="inve"></PrdItem>
        <!-- </navigator> -->
    </div>
  </div>
</template>

<script>
import PrdItem from '@/components/merber/index/component/prd_item.vue'

export default {
  components: { PrdItem },
  data () {
    return {
      list: {}
    }
  },
  mounted () {
    window.addEventListener('scroll', this.handleScroll, true)
  },
  created () {
    let list = localStorage.getItem('is_gift_bag')
    let listArr = []
    try {
      listArr = JSON.parse(list)
      this.list = listArr
    } catch (e) {
      this.list = []
    } finally {

    }
    this.getPackList()
  },
  methods: {
    getPackList () {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'product', params: { is_gift_bag: 1, pagesize: 100 }, method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            this.list = resp.data.list
            localStorage.setItem('is_gift_bag', JSON.stringify(resp.data.list))
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>

<style lang="css" scoped>
</style>
